//
//  InfoViewController.swift
//  1010
//
//  Created by 米明 on 15/7/28.
//  Copyright (c) 2015年 米明. All rights reserved.
//

import UIKit

class InfoViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        var info = ""
        
        let df = UserDefaults.standard
        let languages:Array<String> = df.object(forKey: "AppleLanguages") as! Array<String>
        let language = languages[0]
        
        if language == "zh-Hans-CN" {
            info = "方方\n版本号:\n\(versionInfo())\n设计:\nLy\n感谢:\n1010!\n\n背景音乐:\nMaxwell's Silver Hammer\n\n微信:\nUkulelee"
        }else{
            info = "FangFang\nVersion:\n\(versionInfo())\nDesigned by:\nLv\nThanks to:\n1010!\n\nBGM:\nMaxwell's Silver Hammer\n\nWeChat:\nUkulelee"
        }
        
        self.view.addSubview(infoLabel(info: info))
        // Do any additional setup after loading the view.
    }
    
    func infoLabel(info:String) -> UILabel {
        let label = UILabel(frame: CGRect(x: 0, y: 0, width: SCREEN_SIZE.width, height: SCREEN_SIZE.height))
        self.view.addSubview(label)
        label.font = UIFont(name: FONTNAME_CN, size: 14)
        label.text=info
        label.textColor=UIColor.white
        label.textAlignment=NSTextAlignment.center
        label.numberOfLines=0
        return label
    }
    
    func versionInfo() -> String {
        let path = Bundle.main.path(forResource: "Info", ofType: "plist")
        let info = NSDictionary(contentsOfFile: path!)
        let versionString = info?.object(forKey: "CFBundleShortVersionString") as! String
        let bundle = info?.object(forKey: "CFBundleVersion") as! String
        return versionString + "(" + bundle + ")"
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.view.backgroundColor=LYColor.BackColor()
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.navigationController?.popViewController(animated: false)
    }

    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
